package top.xly.service.impl;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import top.xly.repository.UserRepository;
import top.xly.service.LoginService;

/**
 * Created by nick02.li on 2016/10/27.
 */
@Service
public class LoginServiceImpl implements LoginService {

    @Autowired
    private UserRepository userRepository;

    public String getUserNameById(int id) {
        return userRepository.getUserNameById(id);
    }

    public boolean login(String username, String password) {
        String passwordIndb = userRepository.login(username);
        if(passwordIndb!=null && passwordIndb.equals(password))
            return true;
        return false;
    }
}
